import types from '../../types'

export default {
  [types.GET_USER_INFO] (state, info) {
    if (!(info.LoanedItems instanceof Array)) {
      const temp = []
      temp.push(info.LoanedItems)
      info.LoanedItems = temp
    }
    state.user = info
  },

  [types.SET_LOGIN_ID] (state, id) {
    state.loginId = id
  },

  [types.LOG_OUT] (state) {
    state.loginId = null
    state.user = null
  }
}
